/////precompiled////////
#include "precompiled.h"
////////////////////////


#include "prs_TNodeSRule.h"
using namespace prs;

// TNodeSRule /////////////////////////////////////////////////////////////////

//
void TNodeSRule::FName(snt::TParams &Params)
{
  svl::TNodeS *Node = dynamic_cast<svl::TNodeS*>(Params.Pop().Pointer());
  svl::TString Name = Params.Pop().String();

  svl::TNodeS *NewNode = Node->Children.NewLast();
    NewNode->Name = Name;
}

//
void TNodeSRule::FValue(snt::TParams &Params)
{
  svl::TNodeS *Node  = dynamic_cast<svl::TNodeS*>(Params.Pop().Pointer());
  svl::TString Value = Params.Pop().String();

  svl::TNodeSArray &Children = Node->Children; if (Children.Count())
    { Children[Children.Count()-1].Value = Value;}
}

//
void TNodeSRule::FL(snt::TParams &Params)
{
  TNodeSRule  *This = dynamic_cast<TNodeSRule*> (Params.Pop().Pointer());
  svl::TNodeS *Node = dynamic_cast<svl::TNodeS*>(Params.Pop().Pointer());

  svl::TNodeSArray &Children = Node->Children; if (Children.Count())
    { This->Node = &Children[Children.Count()-1];}
}

//
void TNodeSRule::FR(snt::TParams &Params)
{
  TNodeSRule    *This = dynamic_cast<TNodeSRule*>(Params.Pop().Pointer());
  svl::TVariant &VNode = Params.Pop();
  svl::TNodeS   *Node = dynamic_cast<svl::TNodeS*>(VNode.Pointer());

  VNode = Node->Parent;
}
